package indi.zhifa.study2025.oa.service.menu.impl;

import indi.zhifa.engine.core.common.entity.web.ServiceException;
import indi.zhifa.study2025.oa.dao.gen.service.IGenAppDbService;
import indi.zhifa.study2025.oa.dao.po.GenAppEntity;
import indi.zhifa.study2025.oa.service.menu.IAppService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

@RequiredArgsConstructor
@Component
public class AppServiceImpl implements IAppService {

    final IGenAppDbService mAppDbService;

    @Override
    public GenAppEntity create(GenAppEntity pGenAppEntity) {
        if(!mAppDbService.save(pGenAppEntity)){
            throw new ServiceException("存储GenAppEntity失败");
        }
        return pGenAppEntity;
    }

    @Override
    public GenAppEntity edit(Long id, Object pAppDto) {
        return mAppDbService.updatePull(id, pAppDto);
    }

    @Override
    public GenAppEntity delete(Long pId) {
        return mAppDbService.deleteById(pId);
    }

    @Override
    public GenAppEntity check(Long pId) {
        return mAppDbService.check(pId);
    }
}
